package com.axing.xingxianggateway;

import com.axing.springbootinit.provider.DemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Service;


@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDubbo
@Service
public class XingxiangGatewayApplication {
    @DubboReference
    private DemoService demoService;

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(XingxiangGatewayApplication.class, args);
        XingxiangGatewayApplication bean = context.getBean(XingxiangGatewayApplication.class);
        String s = bean.sayHello("world");
        System.out.println(s);
    }


    public String sayHello(String name) {return demoService.sayHello(name);}

   /* @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("xing", r -> r.path("/get")
                        .uri("http://baidu.com"))
                .route("host_route", r -> r.host("*.myhost.org")
                        .uri("http://httpbin.org"))
                .build();
    }*/
}
